﻿using DevExpress.XtraReports.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DXWinformReport
{
    public partial class Form1 : DevExpress.XtraEditors.XtraForm
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 报表预览按钮
        /// 实现报表的预览、打印、发布用的
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPreview_Click(object sender, EventArgs e)
        {
            //report01 rept01 = new report01();
            //report04 rept = new report04();
            XtraReport6 rept = new XtraReport6(); // 报表实例
            ReportPrintTool tool = new ReportPrintTool(rept); // 用来报表的预览、打印、发布用的
            tool.ShowPreview();//预览报表
        }

        /// <summary>
        /// 报表打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrint_Click(object sender, EventArgs e)
        {
            report01 rept01 = new report01();  // 报表实例

            rept01.Print(); // 报表可以直接打印
        }

        /// <summary>
        /// 报表设计
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSet_Click(object sender, EventArgs e)
        {
            report01 rept01 = new report01(); // 报表实例
            rept01.ShowDesignerDialog();  // 弹出报表设计页面-可以编辑报表
        }

        /// <summary>
        /// 加载报表-加载导出的报表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoad_Click(object sender, EventArgs e)
        {
            XtraReport rept001 = new XtraReport();  // 报表对象
            // 加载报表
            rept001.LoadLayout(@"D:\工作\基础班Vip03\Winform+WPF+上位机直播第三期\20211231就业班03期Course45DevReportAndChartControl\report01.repx");
            rept001.ShowPreview();  // 显示加载的报表
        }
    }
}
